package table_bank

import (
	"time"

	"gitee.com/klein-x/biz/model/mysql/table"
	"gitee.com/klein-x/biz/module/db/mysql"
	"gorm.io/gorm"
)

type BankBackground struct {
	BackgroundID   string         `gorm:"primaryKey;type:char(36);unique;not null;comment:'题目背景ID'"`
	BackgroundText string         `gorm:"type:text;comment:'题目背景文本'"`
	CreatedAt      time.Time      `gorm:"comment:'创建时间'"`
	UpdatedAt      time.Time      `gorm:"comment:'更新时间'"`
	DeletedAt      gorm.DeletedAt `gorm:"comment:'软删除时间'"`
}

func (bb *BankBackground) TableName() string {
	return "bank_background"
}

func BackGroundGetByKey(key string) (*BankBackground, error) {
	db := mysql.GetGlobalDB()
	var question BankBackground
	return table.SelectCheck(&question, db.Where("background_id = ?", key).First(&question))
}
